negotiator.utility
Class DataObjects

java.lang.Object
  extended by negotiator.utility.DataObjects

public class DataObjects
extends java.lang.Object

This class handles saving and loading data for agents which are negotiating in a specific preference profile. Every unique combination of an agent class name and a preference profile name will be saved in a different file; for identification.

Author:
Samanta H.

Constructor Summary
DataObjects(java.lang.String dataFolderName)
           
 
Method Summary
 java.lang.String getAbsPath()
           
 java.io.Serializable loadData(java.lang.String agentClassName, java.lang.String prefProfName)
          Loads the data of the agent, by the agentClassName and the prefProfName.
 boolean restartFolder()
          Restarts the folder "theFolder", meaning it deletes all files in it and then creates a new empty folder with the same name.
 boolean saveData(java.io.Serializable dataToSave, java.lang.String agentClassName, java.lang.String prefProfName)
          Saves dataToSave of the agent with class agentClassName for a preference profile prefProfName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataObjects

public DataObjects(java.lang.String dataFolderName)
Method Detail

restartFolder

public boolean restartFolder()
Restarts the folder "theFolder", meaning it deletes all files in it and then creates a new empty folder with the same name.

Returns:
true if succeeded

saveData

public boolean saveData(java.io.Serializable dataToSave,
                        java.lang.String agentClassName,
                        java.lang.String prefProfName)
Saves dataToSave of the agent with class agentClassName for a preference profile prefProfName. It creates a unique name (concatenating the agent class name and the preference profile file name) to be the name of the file which will contain dataToSave.

Parameters:
dataToSave - a Serializable object to save
agentClassName - is the class name of the agent who wants to save the data
prefProfName - is the preference profile for which the agent wants to save data
Returns:
true if dataToSave was saved successfully false otherwise.

loadData

public java.io.Serializable loadData(java.lang.String agentClassName,
                                     java.lang.String prefProfName)
Loads the data of the agent, by the agentClassName and the prefProfName. It identifies the data by a unique name (concatenating the agent class name and the preference profile file name) which is the name of the file containing the data.

Parameters:
agentClassName - is the class name of the agent who wants to load the data
prefProfName - is the preference profile for which the agent wants to load the data
Returns:
the data that was saved by the agent when he was in the role of the preference profile filename.

getAbsPath

public java.lang.String getAbsPath()